package br.ufpe.cin.rgms.aspects;

import br.ufpe.cin.rgms.util.HibernateUtil;

public privileged aspect PostgresqlPersistenceInitialization {

	before() : execution(void HibernateUtil.initiliazeProperties()) {
		changeConfigurationProperties();
	}

	public static void changeConfigurationProperties() {
		HibernateUtil.conf.setProperty("hibernate.connection.username", "postgres");
		HibernateUtil.conf.setProperty("hibernate.connection.password", "123456");
		HibernateUtil.conf.setProperty("hibernate.hbm2ddl.auto", "auto");
		
		String driverClass = "org.postgresql.Driver";
		String dialect = "org.hibernate.dialect.PostgreSQLDialect";
		String url = "jdbc:postgresql://localhost/postgres-new/rgms";

		HibernateUtil.conf.setProperty("hibernate.connection.url", url);
		HibernateUtil.conf.setProperty("hibernate.connection.driver_class", driverClass);
		HibernateUtil.conf.setProperty("hibernate.dialect", dialect);
	}
}
